<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>申报列表</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" type="text/css" href="/lib/layui/layui/css/layui.css"/>
    <script type="text/javascript" src="/js/news/jquery-1.9.1.js"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/jquery/jquery.cookie.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" src="/lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/layui.all.js"></script>
</head>
<style>
    .btn{
        text-align: right;
    }
    .layui-table-cell .layui-form-checkbox[lay-skin=primary]{
        top:5px;
    }
    .layui-layer-dialog{
        top:240px!important;
    }
</style>
<body>
<div>
    <div class="item">
        <img src="../img/chengguo.png" alt="" style="margin: 0 5px 0 20px;"> <span
            style="font-size: 22px;display: inline-block;vertical-align: middle;">申报列表</span>
    </div>
    <hr  class="layui-bg-blue">
    <div>
        <table class="layui-hide" id="test" lay-filter="test"></table>
    </div>
</div>
</body>
<script type="text/html" id="barDemo">
    {{#  if(d.sDirectorLeaderStatus == 2||d.sDirectorLeaderStatus =="" ||d.sDirectorLeaderStatus ==null){ }}
    <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="look">查看</a>
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</a>
    {{#  }else{ }}
    <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="look">查看</a>
    {{#  } }}
</script>
<script type="text/html" id="xuhao">
    {{d.LAY_TABLE_INDEX+1}}
</script>
<script>
    layui.use(['table','layer','laydate','upload','form'], function(){
        var table = layui.table
            ,layer=layui.layer
            ,laydate=layui.laydate
            ,upload=layui.upload
            ,form=layui.form
        var taskmanager=table.render({
            elem: '#test'
            , url: '/rpmTopic/selectProjectData?userId='+$.cookie('userId')//数据接口
            ,cols: [[
                {type:'checkbox'}
                ,{field: 'numbers', title: '序号',templet: '#xuhao'}
                ,{field:'planName', title: '计划名称', align: 'center'}
                ,{field:'deptName', title: '科室', align: 'center'} //minWidth：局部定义当前单元格的最小宽度，layui 2.2.1 新增
                ,{field:'userName', title: '姓名', align: 'center'}
                ,{field:'filingTime', title: '备案时间', align: 'center'}
                , {field: 'sDirectorLeaderStatus', title: '审核状态',templet: function(d){
                        if(d.sDirectorLeaderStatus=='0'||d.sDirectorLeaderStatus==undefined){
                            return '待审核'
                        }else if(d.sDirectorLeaderStatus=='1'){
                            return '已通过'
                        }else if(d.sDirectorLeaderStatus=='2'){
                            return '已退回'
                        }else{
                            return '未通过'
                        }
                    }}
                ,{field:'sDirectorLeaderOpinion', title: '退回意见', align: 'center'}
                , {field: 'type', width:160,title: '操作', toolbar: '#barDemo'}
            ]],
            page:true
        });
        //监听行工具事件
        table.on('tool(test)', function(obj){
            var data = obj.data;
            var topicId=data.topicId;
            console.log(data)
            if(obj.event == 'look'){
                window.location.href='/Results/listreview?userId='+data.userId+'&planId='+data.planId
            }else if(obj.event == 'edit'){
                window.location.href='/rpmPlan/listreviewedit?userId='+data.userId+'&planId='+data.planId
            }else if(obj.event == 'del'){
                layer.confirm('真的删除当前数据吗？', function (index) {
                    $.ajax({
                        type: 'get',
                        url: '/rpmTopic/deletTopicId?topicId='+topicId,
                        dataType: 'json',
                        success: function (res) {
                            console.log(res)
                            if (res.code == 0) {
                                layer.msg(res.msg);
                                taskmanager.reload()
                            }
                        }
                    })
                });
            }
        });
    })
</script>
</html>
</body>
</html>


